package com.study.leetcode;

public class Solution_168 {

    public String convertToTitle(int columnNumber) {
        StringBuilder stringBuilder = new StringBuilder();
        while (columnNumber != 0) {
            columnNumber--;
            int mod = columnNumber % 26;
            stringBuilder.append((char) ('A' + mod));
            columnNumber = columnNumber / 26;
        }
        return stringBuilder.reverse().toString();
    }

    public static void main(String[] args) {
        Solution_168 solution168 = new Solution_168();
        String title = solution168.convertToTitle(565);
        System.out.println("title = " + title);
    }
}
